
package com.punch.common.feign;


import com.punch.common.constant.ServiceNameConstants;
import com.punch.common.dto.login.WXUserDTO;
import com.punch.common.feign.fallback.FeignTeacherServiceFallbackFactory;
import com.punch.common.model.LoginUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


/**
 * @author zlt
 */

@FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = FeignTeacherServiceFallbackFactory.class, decode404 = true)
public interface FeignTeacherService {

    /**
     * 根据openId获取小程序登录信息
     *
     * @param openId 小程序openId
     */
    @GetMapping(value = "/teacher/openid/{openId}")
    LoginUser getFeignTeacherByOpenId(@PathVariable(value = "openId") String openId);

    /**
     * 根据手机号码获取用户信息
     *
     * @param mobile 手机号码
     */
    @GetMapping(value = "/teacher/mobile/{mobile}")
    LoginUser getFeignTeacherByMobile(@PathVariable(value = "mobile") String mobile);

    /**
     * 进行注册,不存在则注册,存在则返回
     *
     * @param wxUserDTO 微信用户表单
     */
    @PostMapping(value = "/teacher/openid/mobile")
    boolean saveFeignTeacher(@RequestBody WXUserDTO wxUserDTO);
}

